<template>
    <div>
        <h2>登录页面</h2>
        
        <table>
            <tr>
                <td>账号</td>
                <td>
                    <input type="text" v-model="data.zh">
                </td>
            </tr>
             <tr>
                <td>密码</td>
                <td>
                     <input type="text" v-model="data.mm">

                </td>
            </tr>
         
             <tr>
                <td></td>
                <td>
                    <input type="button" value="录入" @click="add">
                </td>
            </tr>
        </table>

    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref,onMounted } from 'vue';
import { useRouter } from 'vue-router';

const data=ref({
  zh:"",
  mm:""
})

const add=()=>{
    axios.get("https://localhost:7258/api/roomfx/login",{params:data.value}).then(res=>{
        if(res.data==-1){
            alert("密码不正确")
        }else if(res.data==1){
            alert("登录成功");
            location.href="/fxadd"
        }else{
            alert("账号不存在");
        }
    })
}

</script>

<style scoped>

</style>